package com.wn.sddfp.common.exception;


import com.wn.sddfp.common.result.enums.IErrorCode;

/**
 * 自定义异常
 *    自定义异常 必须要继承  RuntimeException ？规范
 *
 *    1、自定义异常如何写
 *      1、一般是继承 Exception 和 它的子类都可以 如果是 继承 RuntimeException
 *        抛出异常可以不用检查、代码简洁一点
 *      2、spring中事务管理中\默认事务回滚的异常是 RuntimeException
 *
 */
public class BusinessException extends RuntimeException{

    private IErrorCode errorCode;

    public IErrorCode getErrorCode() {
        return errorCode;
    }

    public BusinessException() {
    }

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(IErrorCode errorCode) {
        super();
        this.errorCode = errorCode;
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
    }

    public BusinessException(Throwable cause) {
        super(cause);
    }

    public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }
}
